package com.chinaisafe.gateway.controller;

import cn.dev33.satoken.context.SaHolder;
import cn.dev33.satoken.oauth2.logic.SaOAuth2Handle;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * SaOAuth2ServerController
 * Sa-OAuth2 Server端 控制器
 * @author xuefu.shu
 * @date 2024-07-03 10:42
 */
@Slf4j
@RestController
@RequestMapping("/oauth2")
public class SaOauth2ServerController {

    /**
     * 处理所有OAuth相关请求
     * @return
     * @author xuefu.shu
     * @date 2024-07-11 18:45
     */
    @RequestMapping("/*")
    public Object request() {
        if (log.isDebugEnabled()) {
            log.info("进入请求:{} ", SaHolder.getRequest().getUrl());
        }
        return SaOAuth2Handle.serverRequest();
    }

}
